package com.boss.controller;

import com.alibaba.fastjson.JSON;
import com.boss.entity.CvInfo;
import com.boss.service.CvInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class CvInfoController  {
    @Autowired
    private CvInfoService cvInfoService;

    /**
     * 查询信息
     * @param cvInfo
     * @return
     */
    @RequestMapping("/cvInfoSelect")
    public String select(CvInfo cvInfo){
        List<CvInfo> list = cvInfoService.getCvInfo(cvInfo);
        String json = JSON.toJSONString(list);
        return json;
    }
    /**
     *添加信息
     * @param cvInfo
     * @return
     */
    @RequestMapping("/cvInfoAdd")
    public void add(CvInfo cvInfo){
        if(cvInfoService.addCvInfo(cvInfo)==true){
            System.out.println("添加成功");
        }else{
            System.out.println("添加失败");
        }
    }
    /**
     *修改信息
     * @param cvInfo
     * @return
     */
    @RequestMapping("/cvInfoUpdate")
    public void update(CvInfo cvInfo){
        if(cvInfoService.updateCvInfo(cvInfo)==true){
            System.out.println("修改成功");
        }else{
            System.out.println("修改失败");
        }
    }

}
